import {MutationTree} from 'vuex';
import {InterfaceUser} from '@/interface/InterfaceUser';
import * as types from '@/store/mutation-types';

export default class DeviceStore {
    public static state: any = {
        status: false,
        versionName: '1.1.1',
        versionCode: '0',
        wechat: false,
        netVersionCode: '0',
    };

    public static mutations: MutationTree<InterfaceUser> = {
        [types.DEVICE_READY](state: any) {
            state = Object.assign(state, {status: true});
        },
        [types.UPDATE_VERSION_CODE](state: any, code: string) {
            state = Object.assign(state, {versionCode: code});
        },
        [types.UPDATE_NET_VERSION_CODE](state: any, code: string) {
            state = Object.assign(state, {netVersionCode: code});
        },
        [types.UPDATE_VERSION_NAME](state: any, name: string) {
            state = Object.assign(state, {versionName: name});
        },
        [types.WECHAT_READY](state: any, status: boolean) {
            state = Object.assign(state, {wechat: status});
        },
    };
}
